package cn.lml.lession.util;

import java.util.HashMap;

import javax.servlet.http.HttpSession;

public class SessionUtils {
    private static HashMap<String,HttpSession> sessionMap=new HashMap<String,HttpSession>();;
 
    private SessionUtils() {
    }
 
    public synchronized static void addSession(HttpSession session) {
        if (session != null) {
            sessionMap.put(session.getId(), session);
        }
    }
 
    public synchronized static void delSession(HttpSession session) {
        if (session != null) {
            sessionMap.remove(session.getId());
        }
    }
 
    public synchronized static HttpSession getSession(String sessionID) {
        if (sessionID == null) {
            return null;
        }
        return sessionMap.get(sessionID);
    }
 
}

